Using Iris to access data from COAWST (curvilinear grid ROMS model output)


In [1]:
from IPython.core.display import HTML
HTML('<iframe src=http://scitools.org.uk/iris/ width=800 height=350></iframe>')


Out[1]:

In [2]:
import numpy
import matplotlib.pyplot as plt
import datetime as dt

import iris
import iris.quickplot as qplt
import cartopy.crs as ccrs

In [3]:
def time_near(cube,start):
    timevar=cube.coord('time')
    itime = timevar.nearest_neighbour_index(timevar.units.date2num(start))
    return timevar.points[itime]

In [4]:
# DAP URL: USGS COAWST model
# cubes = iris.load('http://geoport.whoi.edu/thredds/dodsC/fmrc/NCEP/ww3/cfsr/4m/best')
cubes = iris.load('http://geoport.whoi.edu/thredds/dodsC/coawst_4/use/fmrc/coawst_4_use_best.ncd');

In [5]:
print cubes


0: grid type logical switch / no_unit  (*ANONYMOUS*: 64)
1: net longwave radiation flux / watt meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
2: sediment surface layer erosing rate / kilogram meter-2 second-1 (*ANONYMOUS*: 6)
3: tracers outflow, nudging inverse time scale / second-1 (*ANONYMOUS*: 4; *ANONYMOUS*: 8)
4: evaporation rate / kilogram meter-2 second-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
5: erosion or deposition / meter       (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
6: sediment critical shear for deposition / Newton meter-2 (*ANONYMOUS*: 6)
7: sediment critical shear for erosion / Newton meter-2 (*ANONYMOUS*: 6)
8: net latent heat flux / watt meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
9: sediment median grain density / kilogram meter3 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
10: current-induced, bottom v-momentum stress / newton meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
11: wind-induced, bottom v-momentum stress / newton meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
12: wind-induced significant wave height / meter (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
13: bed load flux of sand in V-direction, size class 03 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
14: bed load flux of sand in V-direction, size class 02 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
15: bed load flux of sand in V-direction, size class 01 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
16: bed load flux of sand in V-direction, size class 06 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
17: bed load flux of sand in V-direction, size class 05 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
18: bed load flux of sand in V-direction, size class 04 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
19: Tracers nudging/relaxation inverse time scale / day-1 (*ANONYMOUS*: 8)
20: sediment porosity / unknown         (*ANONYMOUS*: 6)
21: surface u-momentum stress / newton meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
22: vertically integrated v-momentum component / meter second-1 (time: 3484; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
23: wind-induced bottom wave Period / second (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
24: free-surface inflow, nudging inverse time scale / second-1 (*ANONYMOUS*: 4)
25: background vertical mixing coefficient for tracers / meter2 second-1 (*ANONYMOUS*: 8)
26: max wave and current bottom stress magnitude / newton meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
27: noncohesive sediment fraction, size class 02 / unknown (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
28: noncohesive sediment fraction, size class 03 / unknown (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
29: surface net heat flux / watt meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
30: noncohesive sediment fraction, size class 01 / unknown (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
31: noncohesive sediment fraction, size class 06 / unknown (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
32: noncohesive sediment fraction, size class 04 / unknown (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
33: noncohesive sediment fraction, size class 05 / unknown (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
34: current-induced, bottom u-momentum stress / newton meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
35: wind-induced, bottom u-momentum stress / newton meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
36: bed load flux of sand in U-direction, size class 02 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
37: bed load flux of sand in U-direction, size class 03 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
38: bed load flux of sand in U-direction, size class 01 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
39: bed load flux of sand in U-direction, size class 06 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
40: surface v-momentum stress / newton meter-2 (time: 3484; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
41: bed load flux of sand in U-direction, size class 04 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
42: bed load flux of sand in U-direction, size class 05 / kilogram meter-1 s-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
43: noncohesive sediment mass, size class 06 / kilogram meter-2 (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
44: noncohesive sediment mass, size class 04 / kilogram meter-2 (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
45: noncohesive sediment mass, size class 05 / kilogram meter-2 (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
46: noncohesive sediment mass, size class 02 / kilogram meter-2 (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
47: noncohesive sediment mass, size class 03 / kilogram meter-2 (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
48: noncohesive sediment mass, size class 01 / kilogram meter-2 (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
49: sediment particle settling velocity / millimeter second-1 (*ANONYMOUS*: 6)
50: vertical momentum component / meter second-1 (time: 3484; S-coordinate at W-points: 17; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
51: coupling vertically integrated u-momentum component / meter second-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
52: erosion flux / kilogram meter-2     (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
53: tracers inflow, nudging inverse time scale / second-1 (*ANONYMOUS*: 4; *ANONYMOUS*: 8)
54: mask on V-points / unknown          (*ANONYMOUS*: 335; *ANONYMOUS*: 896)
55: mask on U-points / unknown          (*ANONYMOUS*: 336; *ANONYMOUS*: 895)
56: mask on RHO-points / unknown        (*ANONYMOUS*: 336; *ANONYMOUS*: 896)
57: surface u-wind component / meter second-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
58: sediment median critical erosion stress / newton meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
59: net sensible heat flux / watt meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
60: salinity vertical diffusion coefficient / meter2 second-1 (time: 3484; S-coordinate at W-points: 17; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
61: vertical viscosity coefficient / meter2 second-1 (time: 3484; S-coordinate at W-points: 17; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
62: temperature vertical diffusion coefficient / meter2 second-1 (time: 3484; S-coordinate at W-points: 17; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
63: 3D momentum inflow, nudging inverse time scale / second-1 (*ANONYMOUS*: 4)
64: 2D momentum outflow, nudging inverse time scale / second-1 (*ANONYMOUS*: 4)
65: bottom ripple length / meter        (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
66: wet/dry mask on U-points / unknown  (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
67: curvilinear coordinate metric in ETA / meter-1 (*ANONYMOUS*: 336; *ANONYMOUS*: 896)
68: curvilinear coordinate metric in XI / meter-1 (*ANONYMOUS*: 336; *ANONYMOUS*: 896)
69: 3D momentum outflow, nudging inverse time scale / second-1 (*ANONYMOUS*: 4)
70: wet/dry mask on V-points / unknown  (time: 3484; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
71: wind-induced mean wavelength / meter (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
72: sediment median grain settling velocity / meter second-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
73: wind-induced peak surface wave Period / second (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
74: Coriolis parameter at RHO-points / second-1 (*ANONYMOUS*: 336; *ANONYMOUS*: 896)
75: vertically integrated u-momentum component / meter second-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
76: v-momentum component / meter second-1 (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 335; *ANONYMOUS*: 896)
77: sediment layer porosity / unknown   (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
78: coupling vertically integrated v-momentum component / meter second-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
79: wet/dry mask on RHO-points / unknown (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
80: default bottom roughness length / meter (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
81: suspended noncohesive sediment, size class 02 / kilogram meter-3 (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
82: suspended noncohesive sediment, size class 03 / kilogram meter-3 (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
83: suspended noncohesive sediment, size class 01 / kilogram meter-3 (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
84: angle between XI-axis and EAST / radians (*ANONYMOUS*: 336; *ANONYMOUS*: 896)
85: suspended noncohesive sediment, size class 04 / kilogram meter-3 (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
86: suspended noncohesive sediment, size class 05 / kilogram meter-3 (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
87: wind-induced wave direction / degrees (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
88: sediment layer age / seconds        (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
89: 2D momentum inflow, nudging inverse time scale / second-1 (*ANONYMOUS*: 4)
90: sediment median grain diameter size / meter (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
91: surface v-wind component / meter second-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
92: rain fall rate / kilogram meter-2 second-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
93: mask on psi-points / unknown        (*ANONYMOUS*: 335; *ANONYMOUS*: 895)
94: density anomaly / kilogram meter-3  (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
95: suspended noncohesive sediment, size class 06 / kilogram meter-3 (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
96: apparent bottom roughness length / meter (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
97: free-surface outflow, nudging inverse time scale / second-1 (*ANONYMOUS*: 4)
98: sediment bed layer thickness / meter (time: 3484; ocean_sigma_coordinate: 1; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
99: bed wave excursion amplitude / meter (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
100: u-momentum component / meter second-1 (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 895)
101: potential temperature / Celsius     (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
102: wind-induced bottom orbital velocity / meter second-1 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
103: solar shortwave radiation flux / watt meter-2 (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
104: salinity / unknown                  (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
105: bottom ripple height / meter        (time: 3484; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
106: forecast_period / hours since 2012-06-25T01:00:00Z (time: 3484)

In [6]:
#temp=cubes[0]
temp=cubes[101]

In [7]:
print temp


potential temperature / Celsius     (time: 3484; S-coordinate at RHO-points: 16; *ANONYMOUS*: 336; *ANONYMOUS*: 896)
     Dimension coordinates:
          time                           x                                 -                -                 -
          S-coordinate at RHO-points     -                                 x                -                 -
     Auxiliary coordinates:
          forecast_reference_time        x                                 -                -                 -
          latitude                       -                                 -                x                 x
          longitude                      -                                 -                x                 x
     Attributes:
          CPP_options: ISABEL, ATM_PRESS, ANA_BPFLUX, ANA_BSFLUX, ANA_BTFLUX, ANA_FSOBC, ANA_M2OBC,...
          Conventions: CF-1.4, _Coordinates
          _ChunkSize: [  1   4 112 299]
          _CoordSysBuilder: ucar.nc2.dataset.conv.CF1Convention
          _DODS_Unlimited_Dimension: ocean_time
          ana_file: ROMS/Functionals/ana_btflux.h, ROMS/Functionals/ana_fsobc.h, ROMS/Functionals/ana_m2obc.h,...
          bry_file: ./forcings3/USE_coawst_bdy.nc
          cdm_data_type: GRID
          clm_file: ./forcings3/USE_coawst_clm.nc
          code_dir: /raid1/barmstrong/Projects/COAWST_4
          compiler_command: /usr/local/mpi/bin/mpif90
          compiler_flags:  -fastsse -Mipa=fast -tp k8-64 -Mfree
          compiler_system: pgi
          cpu: x86_64
          featureType: GRID
          field: temperature, scalar, series
          file: ./Output/coawst_use_his_0001.nc
          format: netCDF-3 classic file
          frc_file_01: ./forcings/cloud_coawst.nc
          frc_file_02: ./forcings/Pair_coawst.nc
          frc_file_03: ./forcings/Qair_coawst.nc
          frc_file_04: ./forcings/rain_coawst.nc
          frc_file_05: ./forcings/swrad_coawst.nc
          frc_file_06: ./forcings/Tair_coawst.nc
          frc_file_07: ./forcings/lwrad_coawst.nc
          frc_file_08: ./forcings/Big_grd2_coawstwind.nc
          frc_file_09: ./grids/tide_forc_USeast_grd16_osu_rev1.nc
          grd_file: ./grids/USeast_grd19.nc
          header_dir: /raid1/barmstrong/Projects/COAWST_4/Projects/coawst
          header_file: coawst.h
          his_base: ./Output/coawst_use_his
          history: ROMS/TOMS, Version 3.4, Friday - March 29, 2013 -  3:36:45 AM ;
FMRC Best...
          ini_file: ./restart/ocean_use_rst.nc
          location: Proto fmrc:coawst_4_use
          os: Linux
          rst_file: ./Output/ocean_use_rst.nc
          script_file: Projects/coawst/ocean_coawst.in
          svn_rev: exported
          svn_url: https://www.myroms.org/svn/omlab/branches/jcwarner
          tiling: 010x004
          time: ocean_time
          title: COAWST
          type: ROMS/TOMS history file

In [8]:
# slice by indices
# use contraints to select geographic subset and nearest time
#mytime=dt.datetime(2013,3,1,12)  #specified time...
mytime=dt.datetime.utcnow()      # .... or now
slice=temp.extract(iris.Constraint(time=time_near(temp,mytime)))
slice=slice[-1,:,:]  # surface
print slice


potential temperature / Celsius     (*ANONYMOUS*: 336; *ANONYMOUS*: 896)
     Auxiliary coordinates:
          latitude                              x                 x
          longitude                             x                 x
     Scalar coordinates:
          S-coordinate at RHO-points: -0.03125
          forecast_reference_time: 2013-04-02 13:00:00
          time: 2013-04-03 00:00:00
     Attributes:
          CPP_options: ISABEL, ATM_PRESS, ANA_BPFLUX, ANA_BSFLUX, ANA_BTFLUX, ANA_FSOBC, ANA_M2OBC,...
          Conventions: CF-1.4, _Coordinates
          _ChunkSize: [  1   4 112 299]
          _CoordSysBuilder: ucar.nc2.dataset.conv.CF1Convention
          _DODS_Unlimited_Dimension: ocean_time
          ana_file: ROMS/Functionals/ana_btflux.h, ROMS/Functionals/ana_fsobc.h, ROMS/Functionals/ana_m2obc.h,...
          bry_file: ./forcings3/USE_coawst_bdy.nc
          cdm_data_type: GRID
          clm_file: ./forcings3/USE_coawst_clm.nc
          code_dir: /raid1/barmstrong/Projects/COAWST_4
          compiler_command: /usr/local/mpi/bin/mpif90
          compiler_flags:  -fastsse -Mipa=fast -tp k8-64 -Mfree
          compiler_system: pgi
          cpu: x86_64
          featureType: GRID
          field: temperature, scalar, series
          file: ./Output/coawst_use_his_0001.nc
          format: netCDF-3 classic file
          frc_file_01: ./forcings/cloud_coawst.nc
          frc_file_02: ./forcings/Pair_coawst.nc
          frc_file_03: ./forcings/Qair_coawst.nc
          frc_file_04: ./forcings/rain_coawst.nc
          frc_file_05: ./forcings/swrad_coawst.nc
          frc_file_06: ./forcings/Tair_coawst.nc
          frc_file_07: ./forcings/lwrad_coawst.nc
          frc_file_08: ./forcings/Big_grd2_coawstwind.nc
          frc_file_09: ./grids/tide_forc_USeast_grd16_osu_rev1.nc
          grd_file: ./grids/USeast_grd19.nc
          header_dir: /raid1/barmstrong/Projects/COAWST_4/Projects/coawst
          header_file: coawst.h
          his_base: ./Output/coawst_use_his
          history: ROMS/TOMS, Version 3.4, Friday - March 29, 2013 -  3:36:45 AM ;
FMRC Best...
          ini_file: ./restart/ocean_use_rst.nc
          location: Proto fmrc:coawst_4_use
          os: Linux
          rst_file: ./Output/ocean_use_rst.nc
          script_file: Projects/coawst/ocean_coawst.in
          svn_rev: exported
          svn_url: https://www.myroms.org/svn/omlab/branches/jcwarner
          tiling: 010x004
          time: ocean_time
          title: COAWST
          type: ROMS/TOMS history file

In [9]:
def slice_bbox_extract(slice,bbox):
    ''' 
    Extract a subsetted slice inside a lon,lat bounding box
    bbox=[lon_min lon_max lat_min lat_max]
    '''
    data = slice.data
    lons = slice.coord('longitude').points
    lats = slice.coord('latitude').points

    def minmax(v):
        return np.min(v), np.max(v)

    inregion = np.logical_and(np.logical_and(lons > bbox[0], lons < bbox[1]),
                          np.logical_and(lats > bbox[2], lats < bbox[3]))
    # extract the rectangular subarray containing the whole valid region ...
    region_inds = np.where(inregion)
    imin, imax = minmax(region_inds[0])
    jmin, jmax = minmax(region_inds[1])
    subslice = slice[imin:imax+1, jmin:jmax+1]
    return subslice

In [10]:
# bbox to extract
bbox=[ -71.5, -65.0, 39.5, 46.0]
subslice=slice_bbox_extract(slice,bbox)

In [11]:
print subslice


potential temperature / Celsius     (*ANONYMOUS*: 112; *ANONYMOUS*: 171)
     Auxiliary coordinates:
          latitude                              x                 x
          longitude                             x                 x
     Scalar coordinates:
          S-coordinate at RHO-points: -0.03125
          forecast_reference_time: 2013-04-02 13:00:00
          time: 2013-04-03 00:00:00
     Attributes:
          CPP_options: ISABEL, ATM_PRESS, ANA_BPFLUX, ANA_BSFLUX, ANA_BTFLUX, ANA_FSOBC, ANA_M2OBC,...
          Conventions: CF-1.4, _Coordinates
          _ChunkSize: [  1   4 112 299]
          _CoordSysBuilder: ucar.nc2.dataset.conv.CF1Convention
          _DODS_Unlimited_Dimension: ocean_time
          ana_file: ROMS/Functionals/ana_btflux.h, ROMS/Functionals/ana_fsobc.h, ROMS/Functionals/ana_m2obc.h,...
          bry_file: ./forcings3/USE_coawst_bdy.nc
          cdm_data_type: GRID
          clm_file: ./forcings3/USE_coawst_clm.nc
          code_dir: /raid1/barmstrong/Projects/COAWST_4
          compiler_command: /usr/local/mpi/bin/mpif90
          compiler_flags:  -fastsse -Mipa=fast -tp k8-64 -Mfree
          compiler_system: pgi
          cpu: x86_64
          featureType: GRID
          field: temperature, scalar, series
          file: ./Output/coawst_use_his_0001.nc
          format: netCDF-3 classic file
          frc_file_01: ./forcings/cloud_coawst.nc
          frc_file_02: ./forcings/Pair_coawst.nc
          frc_file_03: ./forcings/Qair_coawst.nc
          frc_file_04: ./forcings/rain_coawst.nc
          frc_file_05: ./forcings/swrad_coawst.nc
          frc_file_06: ./forcings/Tair_coawst.nc
          frc_file_07: ./forcings/lwrad_coawst.nc
          frc_file_08: ./forcings/Big_grd2_coawstwind.nc
          frc_file_09: ./grids/tide_forc_USeast_grd16_osu_rev1.nc
          grd_file: ./grids/USeast_grd19.nc
          header_dir: /raid1/barmstrong/Projects/COAWST_4/Projects/coawst
          header_file: coawst.h
          his_base: ./Output/coawst_use_his
          history: ROMS/TOMS, Version 3.4, Friday - March 29, 2013 -  3:36:45 AM ;
FMRC Best...
          ini_file: ./restart/ocean_use_rst.nc
          location: Proto fmrc:coawst_4_use
          os: Linux
          rst_file: ./Output/ocean_use_rst.nc
          script_file: Projects/coawst/ocean_coawst.in
          svn_rev: exported
          svn_url: https://www.myroms.org/svn/omlab/branches/jcwarner
          tiling: 010x004
          time: ocean_time
          title: COAWST
          type: ROMS/TOMS history file

In [12]:
# make the plot
figure(figsize=(12,8))
Z=subslice.data
Zm = ma.masked_where(np.isnan(Z),Z)
ax1 = plt.axes(projection=ccrs.PlateCarree())
ax2=pcolormesh(subslice.coord('longitude').points,subslice.coord('latitude').points,Zm,vmin=0,vmax=20);
dat=slice.coord('time')[0].units.num2date(slice.coord('time')[0].points)
plt.colorbar()
ax1.gridlines(draw_labels=True);
plt.title('Temperature in the Gulf of Maine: %s' % dat)


Out[12]:
<matplotlib.text.Text at 0x49f5710>